package com.ktjiaoyu.springsecuritydemo.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class LoginController {

    @GetMapping("/toLogin")
    public String toLogin(){
        return "login";
    }

//    @PostMapping("/doLogin")
//    public String doLogin(){
//        System.out.println("dologin方法执行了");
//        return "main";
//    }

    @RequestMapping("/toMain")
    public String toMain(){
        return "main";
    }

    @RequestMapping("/toError")
    public String toError(){
        return "error";
    }

    @GetMapping("/toMain1")
    @Secured("ROLE_Abc")
    public String toMain1(){
        return "main1";
    }
}
